//
//  NSBundle+GeexVideoRecord.m
//  VideoRecordManager
//
//  Created by zhangbaochuan on 2020/1/14.
//  Copyright © 2020 WangYonghe. All rights reserved.
//

#import "NSBundle+GeexVideoRecord.h"
#import "GeexVideoRecordVC.h"


@implementation NSBundle (GeexVideoRecord)

+ (instancetype)geex_VideoBundle {
    static NSBundle *videoBundle = nil;
    if (videoBundle == nil) {
        //这里不使用mainBundle 为了适配pod 1.x 和0.x
        videoBundle = [NSBundle bundleWithPath:[[NSBundle bundleForClass:[GeexVideoRecordVC class]] pathForResource:@"GeexVideoBundle" ofType:@"bundle"]];
    }
    return videoBundle;
}

+ (UIImage *)geex_ImageWithName:(NSString *)imageName {
//    static UIImage *arrowImage = nil;
//    if (arrowImage == nil) {
//        arrowImage = [[UIImage imageWithContentsOfFile:[[self geex_VideoBundle] pathForResource:imageName ofType:@"png"]] imageWithRenderingMode:UIImageRenderingModeAutomatic];
//    }
//    return arrowImage;
//    Class curClass = NSClassFromString(@"GeexVideoRecordVC");
//    NSBundle *curBundle = [NSBundle bundleForClass:curClass];
//    NSString *floaterBundlePath = [curBundle pathForResource:@"GeexVideoBundle" ofType:@"bundle"];
//    NSBundle *floaterBundle = [NSBundle bundleWithPath:floaterBundlePath];
//    NSString *imagePath = [floaterBundle pathForResource:imageName ofType:@"png"];
//    UIImage *tmpImage = [UIImage imageWithContentsOfFile:imagePath];
//    return tmpImage;
    UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"GeexVideoBundle.bundle/%@.png", imageName]];
    return image;
}
+ (UIImage *)geex_ImageWithName:(NSString *)imageName imageMode:(UIImageRenderingMode)renderingMode {
    static UIImage *arrowImage = nil;
    if (arrowImage == nil) {
        arrowImage = [[UIImage imageWithContentsOfFile:[[self geex_VideoBundle] pathForResource:imageName ofType:@"png"]] imageWithRenderingMode:renderingMode];
    }
    return arrowImage;
}

@end
